<style type="text/css">
    .bjui-pageHeader{
        font-size: 18px;
        font-weight: bold;
    }
    .form{
        padding: 15px;
    }
    .form dl {
        overflow: hidden;
        padding-top: 15px;
    }

    .form dt {
        color: #666;
        float: left;
        font-size: 14px;
        padding: 3px 0 0;
        width: 11%;
    }
    .form dd {
        float: left;
        line-height: 22px;
    }
    dd.desc {
        height: 30px;
        padding: 0 10px;
        width: 150px;
    }
    #wrap{ width: 94%;height: auto; overflow: hidden; margin: 20px auto; padding: 10px 20px;}

#wrap .app{padding: 10px; margin-top: 0px; border: 1px solid #f6f6f6;  border-radius:4px;}

#wrap .app p{height: 30px; line-height: 30px;}
#wrap .app p strong{font-size: 20px; color: #0b99d8;}
#wrap .app dl{margin:10px 0; border: 1px solid #dcdcdc; height: auto;  overflow: hidden;}
#wrap .app dl dt {display: block; height: 30px; line-height: 30px;  background: #e7e7e7; padding:0px 5px;}
#wrap .app dl dt strong{font-size:16px;color:#0b99d8; }
#wrap .app dl dd{height: 30px; line-height: 30px; padding:0px 5px; float: left;}

#wrap .app input{line-height: 30px;}
#wrap .app .disable{ border: 1px dashed #666666;}
.is_menu{
	color: red;
}
#tips{
	margin-top: 10px;
	margin-left: 50px;
}
</style>
<script language="JavaScript">
    $(function(){
        $('input[level=1]').click(function(){
            var inputs = $(this).parents('.app').find('input');
            if ( $(this).attr('checked')) {
                inputs.attr('checked','checked');
            }else {
                inputs.removeAttr('checked');
            }
            
        });

        $('input[level=2]').click(function(){
            var inputs = $(this).parents('dl').find('input');
            if($(this).attr('checked')) {
                inputs.attr('checked','checked');
                var inputParent = $(this).parents('.app').find('p>input');                
                inputParent.attr('checked','checked');

            }else {
                inputs.removeAttr('checked');
            }
            
        });

        $('input[level=3]').click(function(){
            var inputs = $(this).parents('dl').find('dt>input');
            if($(this).attr('checked')) {
                inputs.attr('checked','checked');
                var inputParent = $(this).parents('.app').find('p>input');                
                inputParent.attr('checked','checked');

            }else {
            }
            
        });
    });
    
</script>
<div class="bjui-pageHeader">
    <div class="glyphicon glyphicon-th-large">权限设置</div>
</div>
<div class="bjui-pageContent">
			<div id="tips">
				红色权限表示菜单权限
			</div>
            <div class="list">    
        <div id="wrap">
        <form action="{:U('Auth/access')}" method="post" data-toggle="validate">

        <volist name="result" id="vo">
            <div class="app">
                <dl>
                    <dt><input type="checkbox" name="moduleName[]" value="{$i}" level="2"/> <strong>{$key}</strong></dt>

                        <foreach name="vo" item="v">
                        <dd><input type="checkbox" name="rule[]" value="{$v['id']}" <if condition="in_array($v['id'],$ruleID)">checked="checked"</if> level="3"/> <span <if condition="$v['type'] eq 2"> class="is_menu" </if>>{$v['title']}</span></dd>

                        </foreach>
                </dl>
            </div>
        </volist>
        <input type="hidden" name="id" value="{$id}"/>
        </form>

        </div>   

    </div>
</div>
<div class="bjui-pageFooter">
    <ul>
        <li><button type="button" class="btn-close" data-icon="close">关闭</button></li>
        <li>
            <button data-icon="save" class="btn btn-default" type="submit">保存</button>
        </li>
    </ul>
</div>